#include <cstdio>


#define MAX_N 101
#define ROMAN_SYMBOLS 5

typedef int symbol_array[ROMAN_SYMBOLS];

const char roman_symbol [ROMAN_SYMBOLS] = {
	'i',
	'v',
	'x',
	'l',
	'c'
};


struct symbol_count
{
	bool updated;
	symbol_array s;

	inline void print () {
		printf(" %d %c", s[0], roman_symbol[0]);
		for (size_t i = 1; i < ROMAN_SYMBOLS; ++i)
			printf(", %d %c", s[i], roman_symbol[i]);
	}
};


symbol_count symbols_used[MAX_N] = {
	{1, {0}},
	{1, {1}}
};


/************************************************/


inline void parse_to_roman (const int n, symbol_array out, int pos)
{
	pos += pos;
	const size_t
		n0 = pos,
		n1 = pos + 1,
		n2 = pos + 2;

	switch (n)
	{
		case 1:
			out[n0] += 1;
			break;
		case 2:
			out[n0] += 2;
			break;
		case 3:
			out[n0] += 3;
			break;
		case 4:
		case 6:
			out[n0] += 1;
			out[n1] += 1;
			break;
		case 5:
			out[n1] += 1;
			break;
		case 7:
			out[n0] += 2;
			out[n1] += 1;
			break;
		case 8:
			out[n0] += 3;
			out[n1] += 1;
			break;
		case 9:
			out[n0] += 1;
			out[n2] += 1;
			break;
	}
}


symbol_count & roman_count (int n)
{
	int decimal_position;
	symbol_count &sc = symbols_used[n];

	if (sc.updated)
		return sc;
		
	sc = roman_count (n-1);

	for (decimal_position = 0; n; n /= 10, ++decimal_position)
		parse_to_roman (n % 10, sc.s, decimal_position);


	return sc;
}


/************************************************/


int main ()
{
	int n;

	while (scanf ("%d", &n), n)
	{
		symbol_count &sc = roman_count (n);
		printf("%d:", n);
		sc.print ();
		putchar ('\n');
	}

	return 0;
}